const ua = 'Mozilla/5.0 (iPhone; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 mailapp/6.4.0'

const uaHas = (keyword) => ua.includes(keyword)
const isWindowsPhone = uaHas('windows phone')
const isSymbian = uaHas('symbianos') || isWindowsPhone
const isTdAndroid = uaHas('android-tongdao-app')
const isTdIos = uaHas('ios-tongdao-app')
const isTdRN = uaHas('rn-tongdao-app')
const isAndroid = isTdAndroid || uaHas('android') || uaHas('adr')
const isIos = isTdIos || !!ua.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/i)
const isWx = uaHas('micromessenger')
const isBaidu = uaHas('baidu') || uaHas('baiduboxapp')
const isUc = uaHas('ucbrowser')
const isDingding = uaHas('dingtalk')

const isUcOrDingding = isUc || isDingding
const isTd = isTdAndroid || isTdIos || isTdRN
const isH5 = isAndroid || isIos || isSymbian

console.log('isIos', isIos)
console.log('isAndroid', isAndroid)
console.log('isH5', isH5)